document.querySelector('.login-form .login-btn').addEventListener('click',() => {
    const form = document.querySelector('.login-form')
    const data = serialize(form,{hash:true,empty:true})
    console.log(data)
    if (data.mobile.length !== 11){
        getAlert(document.querySelector('.login-alert'),'手机号必须为11位',false)
        return
    }else if (data.code.length !== 6){
        getAlert(document.querySelector('.login-alert'),'验证码必须为6位',false)
        return
    }
    axios({
        url:'/v1_0/authorizations',
        method:'post',
        data
    }).then(success => {
        getAlert(document.querySelector('.login-alert'),'登录成功！',true)
        localStorage.setItem('token',success.data.token)
        location.href = '../content/index.html'
    }).catch(error => {
        getAlert(document.querySelector('.login-alert'),error.response.data.message,false)
    })
})
